package com.example.mychat.network

object ChatManager {
    private var chatClient: ChatClient? = null

    fun createClient(
        serverAddress: String = "10.129.16.118",
        messageCallback: (String) -> Unit,
        onConnectionError: () -> Unit
    ): ChatClient {
        chatClient?.disconnect()
        return ChatClient(
            serverAddress = serverAddress,
            messageCallback = messageCallback,
            onConnectionError = onConnectionError
        ).also { chatClient = it }
    }

    fun getCurrentClient(): ChatClient? = chatClient
} 